export default{
    namespaced:true,
    state:{
        // 账户信息
        userInfo:{},
        // 用户详细信息
        userDetail:{
            name:'张三',
            avator:'admin.jpg'
        },
        level:''
    },
    mutations:{
        setUserInfo(state,payload){
            state.userInfo=payload
        },
        setUserDetail(state,payload){
            state.userDetail=payload
        }
    },
    // action可以包含异步操作
    actions:{
        
    },
    getters:{
        level(state) {
            let age = state.userDetail.fishage;
            if (age < 2) {
              return "钓鱼菜鸟";
            } else if (age < 5) {
              return "钓鱼小白";
            } else if (age < 10) {
              return "钓鱼精英";
            } else if (age < 15) {
              return "钓鱼高手";
            } else {
              return "骨灰级钓手";
            }
          }
    }
}